/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@import url("./spectrum-action-button.css");
@import url("./action-button-overrides.css");

::slotted([slot="icon"]) {
    flex-shrink: 0;
}

#label {
    flex-grow: var(--spectrum-actionbutton-label-flex-grow);
    text-align: var(--spectrum-actionbutton-label-text-align);
    pointer-events: none !important;
}

/* confirm with css if we can keep it as css level */

:host([size="xs"]) {
    /* Work around non-square icon only Action Buttons in Spectrum CSS */
    min-width: var(--spectrum-actionbutton-height, 0);

    --spectrum-actionbutton-edge-to-visual-only: calc(var(--spectrum-component-edge-to-visual-only-50) - var(--spectrum-actionbutton-border-width));
}

:host([size="s"]) {
    --spectrum-actionbutton-edge-to-visual-only: calc(var(--spectrum-component-edge-to-visual-only-75) - var(--spectrum-actionbutton-border-width));
}

:host([size="m"]) {
    --spectrum-actionbutton-edge-to-visual-only: calc(var(--spectrum-component-edge-to-visual-only-100) - var(--spectrum-actionbutton-border-width));
}

:host([size="l"]) {
    --spectrum-actionbutton-edge-to-visual-only: calc(var(--spectrum-component-edge-to-visual-only-200) - var(--spectrum-actionbutton-border-width));
}

:host([size="xl"]) {
    --spectrum-actionbutton-edge-to-visual-only: calc(var(--spectrum-component-edge-to-visual-only-300) - var(--spectrum-actionbutton-border-width));
}

@media (forced-colors: active) {
    :host {
        --highcontrast-actionbutton-border-color-disabled: GrayText;
        --highcontrast-actionbutton-content-color-disabled: GrayText;
    }
}
